﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common;

namespace Fuxi
{
    public partial class FuxiType
    {
        void MakeRiverDecision()
        {
            double loseOdds = HandEvaluator.GetCurrentLoseOdds(H.MyPocket, F.Board);
            switch (strategy)
            {
                case StrategyType.Basic:
                    if (winOdds > 0.94 ||
                         (winOdds > 0.91 || winOdds > 0.88 && loseOdds < 0.05) && NumFuxiRaised(G.River) == 0 ||
                        H.HavePosition && NumOppRaised(G.Turn) == 0 && NumOppRaised(G.River) == 0 && winOdds > 0.66 ||
                        !H.HavePosition && NumOppRaised(G.Turn) == 0 && NumOppRaised(G.River) == 0 && winOdds > 0.75 ||
                        H.HavePosition && OppNeverRaised && !isOppCallingStation && winOdds < 0.2
                       )

                    {
                        ExecuteRaise();
                    }
                    else if (winOdds > 0.66 || loseOdds < 0.2)
                    {
                        ExecuteCall();
                    }
                    else
                    {
                        ExecuteCheck();
                    }
                    break;
                case StrategyType.Trap:
                    if (!(!H.HavePosition && NumOppRaised(G.Turn) == 0 && OppSbRaiseRate(G.River) > 0.6) &&
                        (winOdds > 0.94 ||
                        (winOdds > 0.91 || winOdds > 0.88 && loseOdds < 0.05) && NumFuxiRaised(G.River) == 0 ||
                        H.HavePosition && NumOppRaised(G.Turn) == 0 && NumOppRaised(G.River) == 0 && winOdds > 0.66 ||
                        !H.HavePosition && NumOppRaised(G.Turn) == 0 && NumOppRaised(G.River) == 0 && winOdds > 0.75
                       )
                        )
                    {
                        ExecuteRaise();
                    }
                    else if (winOdds > (F.ChipsToCall / (F.ChipsToCall + F.Pot)) * 1.2 ||loseOdds < 0.2)
                    {
                        ExecuteCall();
                    }
                    else
                    {
                        ExecuteCheck();
                    }
                    break;
                case StrategyType.Jackel:
                    if (winOdds > 0.94 ||
                        (winOdds > 0.91 || winOdds > 0.88 && loseOdds < 0.05) && NumFuxiRaised(G.River) == 0 ||
                        H.HavePosition && NumOppRaised(G.Turn) == 0 && NumOppRaised(G.River) == 0 && winOdds > 0.66 ||
                        !H.HavePosition && NumOppRaised(G.Turn) == 0 && NumOppRaised(G.River) == 0 && winOdds > 0.75
                    )
                    {
                        ExecuteRaise();
                    }
                    else if (winOdds > 0.66 || loseOdds < 0.2)
                    {
                        ExecuteCall();
                    }
                    else
                    {
                        ExecuteCheck();
                    }
                    break;
                default:
                    break;
            }

        }
    }
}
